<!DOCTYPE html>

<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

<title>module Syctime - Your application title</title>

<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
</script>

<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>


<body id="top" class="module">
<nav id="metadata">
  <nav id="home-section" class="section">
  <h3 class="section-header">
    <a href="./index.html">Home</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </h3>
</nav>


  <nav id="search-section" class="section project-section" class="initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <h3 class="section-header">
      <input type="text" name="search" placeholder="Search" id="search-field"
             title="Type to search, Up and Down to navigate, Enter to load">
    </h3>
  </form>

  <ul id="search-results" class="initially-hidden"></ul>
</nav>


  <div id="file-metadata">
    <nav id="file-list-section" class="section">
  <h3 class="section-header">Defined In</h3>
  <ul>
    <li>lib/syctime/time_util.rb
  </ul>
</nav>

    
  </div>

  <div id="class-metadata">
    
    
    
    <!-- Method Quickref -->
<nav id="method-list-section" class="section">
  <h3 class="section-header">Methods</h3>

  <ul class="link-list">
    
    <li><a href="#method-i-date_between-3F">#date_between?</a>
    
    <li><a href="#method-i-extract_time">#extract_time</a>
    
    <li><a href="#method-i-seconds_to_time">#seconds_to_time</a>
    
    <li><a href="#method-i-separated_time_string">#separated_time_string</a>
    
    <li><a href="#method-i-string_for_seconds">#string_for_seconds</a>
    
    <li><a href="#method-i-time_between-3F">#time_between?</a>
    
    <li><a href="#method-i-time_for_string">#time_for_string</a>
    
    <li><a href="#method-i-valid_date-3F">#valid_date?</a>
    
  </ul>
</nav>

  </div>

  <div id="project-metadata">
    <nav id="fileindex-section" class="section project-section">
  <h3 class="section-header">Pages</h3>

  <ul>
  
    <li class="file"><a href="./README_rdoc.html">README</a>
  
  </ul>
</nav>

    <nav id="classindex-section" class="section project-section">
  <h3 class="section-header">Class and Module Index</h3>

  <ul class="link-list">
  
    <li><a href="./Syctask.html">Syctask</a>
  
    <li><a href="./Syctask/Evaluator.html">Syctask::Evaluator</a>
  
    <li><a href="./Syctask/Meeting.html">Syctask::Meeting</a>
  
    <li><a href="./Syctask/Scanner.html">Syctask::Scanner</a>
  
    <li><a href="./Syctask/Schedule.html">Syctask::Schedule</a>
  
    <li><a href="./Syctask/Settings.html">Syctask::Settings</a>
  
    <li><a href="./Syctask/Statistics.html">Syctask::Statistics</a>
  
    <li><a href="./Syctask/Task.html">Syctask::Task</a>
  
    <li><a href="./Syctask/TaskPlanner.html">Syctask::TaskPlanner</a>
  
    <li><a href="./Syctask/TaskScheduler.html">Syctask::TaskScheduler</a>
  
    <li><a href="./Syctask/TaskService.html">Syctask::TaskService</a>
  
    <li><a href="./Syctask/TaskTracker.html">Syctask::TaskTracker</a>
  
    <li><a href="./Syctask/Times.html">Syctask::Times</a>
  
    <li><a href="./Syctask/Track.html">Syctask::Track</a>
  
    <li><a href="./Sycutil.html">Sycutil</a>
  
    <li><a href="./Sycutil/Console.html">Sycutil::Console</a>
  
    <li><a href="./ConsoleTimer.html">ConsoleTimer</a>
  
    <li><a href="./Object.html">Object</a>
  
    <li><a href="./Sycstring.html">Sycstring</a>
  
    <li><a href="./Syctime.html">Syctime</a>
  
  </ul>
</nav>

  </div>
</nav>

<div id="documentation">
  <h1 class="module">module Syctime</h1>

  <div id="description" class="description">
    
<p>Functions for time operations</p>

  </div><!-- description -->

  
  
  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    

    <!-- Methods -->
    
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
      <h3 class="section-header">Public Instance Methods</h3>

    
      <div id="method-i-date_between-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">date_between?</span><span
            class="method-args">(date, from, to)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Tests whether the date is between from and to. Returns true then otherwise
false. Time, from and to are Time objects as retrieved from Time.now or
Time.local(2013,“apr”,13,10,50,0). Alternatively time strings can be
provided in the form of “2013-04-13”.</p>
          

          
          <div class="method-source-code" id="date_between-3F-source">
            <pre><span class="ruby-comment"># File lib/syctime/time_util.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">date_between?</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
  <span class="ruby-identifier">date</span> = <span class="ruby-identifier">date</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-string">&quot;%Y-%m-%d&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">date</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Time</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">date</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Date</span>
  <span class="ruby-identifier">from</span> = <span class="ruby-identifier">from</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-string">&quot;%Y-%m-%d&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">from</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Time</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">from</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Date</span>
  <span class="ruby-identifier">to</span>   =   <span class="ruby-identifier">to</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-string">&quot;%Y-%m-%d&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">to</span>.<span class="ruby-identifier">class</span>   <span class="ruby-operator">==</span> <span class="ruby-constant">Time</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">to</span>.<span class="ruby-identifier">class</span>   <span class="ruby-operator">==</span> <span class="ruby-constant">Date</span>
  <span class="ruby-identifier">time_pattern</span> = <span class="ruby-regexp">%r\d{4}-\d{2}-\d{2}/</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">date</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">time_pattern</span>).<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">from</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">time_pattern</span>).<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">to</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">time_pattern</span>).<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">date</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">from</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">date</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">to</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- date_between-3F-source -->
          
        </div>

        

        
      </div><!-- date_between-3F-method -->

    
      <div id="method-i-extract_time" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">extract_time</span><span
            class="method-args">(time_string,time=false)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Extracts the time out of a time string. Accepts ‘today’, ‘tomorrow’,
‘yesterday’ or a date in the form ‘YYYY-MM-DD’. Returns the date contained 
in the time_string or if time = true in a Time object</p>
          

          
          <div class="method-source-code" id="extract_time-source">
            <pre><span class="ruby-comment"># File lib/syctime/time_util.rb, line 93</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">extract_time</span>(<span class="ruby-identifier">time_string</span>,<span class="ruby-identifier">time</span>=<span class="ruby-keyword">false</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">time_string</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">%r\d{4}-\d{2}-\d{2}/</span>)
    <span class="ruby-identifier">date</span> = <span class="ruby-identifier">time_string</span> 
    <span class="ruby-identifier">date</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">xmlschema</span>(<span class="ruby-node">&quot;#{time_string}T00:00:00&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">time</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">timeleap</span> = <span class="ruby-constant">SycTimeleap</span><span class="ruby-operator">::</span><span class="ruby-constant">TimeLeap</span>.<span class="ruby-identifier">new</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">date</span> = <span class="ruby-identifier">timeleap</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">time_string</span>)
      <span class="ruby-identifier">date</span> = <span class="ruby-identifier">date</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">time</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NoMethodError</span>
      <span class="ruby-identifier">help_now!</span> <span class="ruby-string">&quot;Arguments may be 'time distances', YYYY-MM-DD or &lt;RETURN&gt;\n&quot;</span><span class="ruby-operator">+</span>
                <span class="ruby-string">&quot;\ntime distances are:\n&quot;</span><span class="ruby-operator">+</span>
                <span class="ruby-string">&quot;* yesterday|today|tomorrow\n&quot;</span><span class="ruby-operator">+</span>
                <span class="ruby-string">&quot;* next|previous_monday|tuesday|...|sunday\n&quot;</span><span class="ruby-operator">+</span>
                <span class="ruby-string">&quot;* in|back_10_days|weeks|months|years\n&quot;</span><span class="ruby-operator">+</span>
                <span class="ruby-string">&quot;* monday|tuesday|...|sunday_in|back_1_day|week|month|year\n&quot;</span><span class="ruby-operator">+</span>
                <span class="ruby-string">&quot;Short forms are also possible:\n&quot;</span><span class="ruby-operator">+</span>
                <span class="ruby-string">&quot;* y|tod|tom\n&quot;</span><span class="ruby-operator">+</span>
                <span class="ruby-string">&quot;* n|pmo|tu|we|th|fr|sa|su\n&quot;</span><span class="ruby-operator">+</span>
                <span class="ruby-string">&quot;* i|b10d|w|m|y\n&quot;</span><span class="ruby-operator">+</span>
                <span class="ruby-string">&quot;* mo|tu|we|th|fr|sa|sui|b1d|w|m|y&quot;</span>
     <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">date</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- extract_time-source -->
          
        </div>

        

        
      </div><!-- extract_time-method -->

    
      <div id="method-i-seconds_to_time" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">seconds_to_time</span><span
            class="method-args">(seconds)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Translates seconds to years, months, weeks, days, hours, minutes and
seconds The return value is an array [seconds,…,years]</p>
          

          
          <div class="method-source-code" id="seconds_to_time-source">
            <pre><span class="ruby-comment"># File lib/syctime/time_util.rb, line 9</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">seconds_to_time</span>(<span class="ruby-identifier">seconds</span>)
  <span class="ruby-identifier">seconds</span> = <span class="ruby-identifier">seconds</span>.<span class="ruby-identifier">round</span>
  <span class="ruby-identifier">duration</span> = []
  <span class="ruby-identifier">duration</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">seconds</span> <span class="ruby-operator">%</span> <span class="ruby-value">60</span>                         <span class="ruby-comment"># seconds</span>
  <span class="ruby-identifier">duration</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">seconds</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">%</span> <span class="ruby-value">60</span>                    <span class="ruby-comment"># minutes</span>
  <span class="ruby-identifier">duration</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">seconds</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">%</span> <span class="ruby-value">24</span>               <span class="ruby-comment"># hours</span>
  <span class="ruby-identifier">duration</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">seconds</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">/</span> <span class="ruby-value">24</span> <span class="ruby-operator">%</span> <span class="ruby-value">7</span>           <span class="ruby-comment"># days</span>
  <span class="ruby-identifier">duration</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">seconds</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">/</span> <span class="ruby-value">24</span> <span class="ruby-operator">/</span> <span class="ruby-value">7</span> <span class="ruby-operator">%</span> <span class="ruby-value">4</span>       <span class="ruby-comment"># weeks</span>
  <span class="ruby-identifier">duration</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">seconds</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">/</span> <span class="ruby-value">24</span> <span class="ruby-operator">/</span> <span class="ruby-value">7</span> <span class="ruby-operator">/</span> <span class="ruby-value">4</span> <span class="ruby-operator">%</span> <span class="ruby-value">12</span>  <span class="ruby-comment"># months</span>
  <span class="ruby-identifier">duration</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">seconds</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">/</span> <span class="ruby-value">24</span> <span class="ruby-operator">/</span> <span class="ruby-value">7</span> <span class="ruby-operator">/</span> <span class="ruby-value">4</span> <span class="ruby-operator">/</span> <span class="ruby-value">12</span>  <span class="ruby-comment"># years</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- seconds_to_time-source -->
          
        </div>

        

        
      </div><!-- seconds_to_time-method -->

    
      <div id="method-i-separated_time_string" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">separated_time_string</span><span
            class="method-args">(seconds, separator)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Creates a time string separating hours, minutes and seconds with the
provided separator like 12:50:33</p>
          

          
          <div class="method-source-code" id="separated_time_string-source">
            <pre><span class="ruby-comment"># File lib/syctime/time_util.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">separated_time_string</span>(<span class="ruby-identifier">seconds</span>, <span class="ruby-identifier">separator</span>)
  <span class="ruby-identifier">secs</span>  = <span class="ruby-identifier">seconds</span> <span class="ruby-operator">%</span> <span class="ruby-value">60</span>
  <span class="ruby-identifier">mins</span>  = <span class="ruby-identifier">seconds</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">%</span> <span class="ruby-value">60</span>
  <span class="ruby-identifier">hours</span> = <span class="ruby-identifier">seconds</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> <span class="ruby-operator">/</span> <span class="ruby-value">60</span> 
  <span class="ruby-identifier">time_string</span> = <span class="ruby-identifier">sprintf</span>(<span class="ruby-node">&quot;%02d#{separator}%02d#{separator}%02d&quot;</span>, <span class="ruby-identifier">hours</span>, <span class="ruby-identifier">mins</span>, <span class="ruby-identifier">secs</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- separated_time_string-source -->
          
        </div>

        

        
      </div><!-- separated_time_string-method -->

    
      <div id="method-i-string_for_seconds" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">string_for_seconds</span><span
            class="method-args">(seconds)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Translates seconds into a time string like 1 year 2 weeks 5 days 10
minutes.</p>
          

          
          <div class="method-source-code" id="string_for_seconds-source">
            <pre><span class="ruby-comment"># File lib/syctime/time_util.rb, line 22</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">string_for_seconds</span>(<span class="ruby-identifier">seconds</span>)
  <span class="ruby-identifier">time</span> = <span class="ruby-identifier">seconds_to_time</span>(<span class="ruby-identifier">seconds</span>)
  <span class="ruby-identifier">time_name</span> = [<span class="ruby-string">'year'</span>,<span class="ruby-string">'month'</span>,<span class="ruby-string">'week'</span>,<span class="ruby-string">'day'</span>,<span class="ruby-string">'hour'</span>,<span class="ruby-string">'minute'</span>,<span class="ruby-string">'second'</span>]
  <span class="ruby-identifier">time_string</span> = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">time</span>.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">part</span>,<span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">time_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">part</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">' '</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">time_name</span>[<span class="ruby-identifier">index</span>] <span class="ruby-operator">+</span> <span class="ruby-string">' '</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">part</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
    <span class="ruby-identifier">time_string</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">part</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">' '</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">time_name</span>[<span class="ruby-identifier">index</span>] <span class="ruby-operator">+</span> <span class="ruby-string">'s '</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">part</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">time_string</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- string_for_seconds-source -->
          
        </div>

        

        
      </div><!-- string_for_seconds-method -->

    
      <div id="method-i-time_between-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">time_between?</span><span
            class="method-args">(time, from, to)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Checks whether the time is between from and to. Returns true then otherwise
false. time, from and to have to be Time objects.</p>
          

          
          <div class="method-source-code" id="time_between-3F-source">
            <pre><span class="ruby-comment"># File lib/syctime/time_util.rb, line 66</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">time_between?</span>(<span class="ruby-identifier">time</span>, <span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
  <span class="ruby-identifier">time</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">from</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">time</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">to</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- time_between-3F-source -->
          
        </div>

        

        
      </div><!-- time_between-3F-method -->

    
      <div id="method-i-time_for_string" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">time_for_string</span><span
            class="method-args">(time)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Translates a time in the ISO 8601 schema to a time object.</p>

<pre>2013-04-09 21:45 -200</pre>
          

          
          <div class="method-source-code" id="time_for_string-source">
            <pre><span class="ruby-comment"># File lib/syctime/time_util.rb, line 44</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">time_for_string</span>(<span class="ruby-identifier">time</span>)
  <span class="ruby-identifier">time</span> = <span class="ruby-identifier">time</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp">%r\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">sub</span>(<span class="ruby-string">' '</span>,<span class="ruby-string">'T'</span>)
  <span class="ruby-constant">Time</span>.<span class="ruby-identifier">xmlschema</span>(<span class="ruby-identifier">time</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- time_for_string-source -->
          
        </div>

        

        
      </div><!-- time_for_string-method -->

    
      <div id="method-i-valid_date-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">valid_date?</span><span
            class="method-args">(date_string)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Checks whether the date is a valid date in the form of yyyy-mm-dd. If it’s
no valid date false is returned otherwise true</p>
          

          
          <div class="method-source-code" id="valid_date-3F-source">
            <pre><span class="ruby-comment"># File lib/syctime/time_util.rb, line 72</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">valid_date?</span>(<span class="ruby-identifier">date_string</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">date_string</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">%r\d{4}-\d{2}-\d{2}/</span>)
    <span class="ruby-keyword">begin</span>
      <span class="ruby-constant">Date</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">date_string</span>)
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">ArgumentError</span>
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-constant">SycTimeleap</span><span class="ruby-operator">::</span><span class="ruby-constant">TimeLeap</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">date_string</span>)
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">rescue</span>
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- valid_date-3F-source -->
          
        </div>

        

        
      </div><!-- valid_date-3F-method -->

    
    </section><!-- public-instance-method-details -->
  
  </section><!-- 5Buntitled-5D -->

</div><!-- documentation -->


<footer id="validator-badges">
  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
</footer>

